Skip to content

Add unique-names anchor to fragments docs - #13365

Merged
jerelmiller merged 3 commits into
apollographql:mainfrom
atharv-sys32:docs/unique-names-anchor
Jul 30, 2026
Merged

Add unique-names anchor to fragments docs#13365
jerelmiller merged 3 commits into
apollographql:mainfrom
atharv-sys32:docs/unique-names-anchor

Conversation

@atharv-sys32

@atharv-sys32 atharv-sys32 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Closes #13292

Adds a dedicated section for the unique-names anchor so graphql-tag warning links resolve properly. This is a docs-only change.

Summary by CodeRabbit

  • Documentation
    • Added guidance on using unique GraphQL fragment names.
    • Included an example warning for fragment name collisions.
    • Recommended descriptive, component-scoped names to prevent conflicts.

@apollo-librarian

apollo-librarian Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

⚠️ AI Style Review — 2 Issues Found

Summary

The documentation has been updated to align with the style guide: structural-elements now use gerunds for conceptual headings; product names like graphql-tag are no longer backticked in products-and-features; verb-tense-and-voice is shifted to active present tense; fragment naming guidelines now use a more authoritative voice; and semicolons in word-and-symbol-usage have been replaced with periods for better readability.

Duration: 3567ms
Review Log: View detailed log

This review is AI-generated. Please use common sense when accepting these suggestions, as they may not always be accurate or appropriate for your specific context.

@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 100510c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds documentation explaining that GraphQL fragment names must be globally unique, showing the graphql-tag warning for collisions and recommending descriptive, component-scoped names.

Changes

Fragment naming documentation

Layer / File(s) Summary
Document unique fragment naming
docs/source/data/fragments.mdx
Adds guidance on globally unique fragment names, duplicate-name warnings, and component-scoped naming.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: bignimbus

Poem

I’m a rabbit with fragments in line,
Keeping each name distinct and fine.
No collisions to warn,
From dusk until morn—
Component-scoped names help them shine!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and relevant, describing the docs update around unique fragment naming and the new anchor.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@atharv-sys32
atharv-sys32 marked this pull request as ready for review July 30, 2026 07:50
@atharv-sys32
atharv-sys32 requested a review from a team as a code owner July 30, 2026 07:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/source/data/fragments.mdx (1)

46-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the library name directly in the guidance.

Consider: “If you reuse a fragment name, graphql-tag warns about the conflict at runtime to help you identify and resolve bugs.” This is clearer and follows the documented product-voice guidance.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/source/data/fragments.mdx` at line 46, Update the fragment-name guidance
to use the library name directly: state that graphql-tag warns about reused
fragment names at runtime, while preserving the existing explanation that the
warning helps identify and resolve bugs.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/source/data/fragments.mdx`:
- Line 54: Update the fragment naming examples in the documentation to use
unambiguously component-scoped names, replacing ItemFragment and
UserProfileFragment with examples such as CartItemFragment and
UserProfileCardFragment while preserving the guidance about avoiding name
collisions.

---

Nitpick comments:
In `@docs/source/data/fragments.mdx`:
- Line 46: Update the fragment-name guidance to use the library name directly:
state that graphql-tag warns about reused fragment names at runtime, while
preserving the existing explanation that the warning helps identify and resolve
bugs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: be85e29c-3a3b-4039-89eb-8a6028628db1

📥 Commits

Reviewing files that changed from the base of the PR and between 8518419 and e06ec68.

📒 Files selected for processing (1)
  • docs/source/data/fragments.mdx

Comment thread docs/source/data/fragments.mdx Outdated
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names
```

As a best practice, use descriptive, component-scoped fragment names (like `ItemFragment` or `UserProfileFragment`) to avoid name collisions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Make the examples unambiguously component-scoped.

ItemFragment and UserProfileFragment describe entities but do not identify an owning component, so they can still collide. Prefer examples such as CartItemFragment or UserProfileCardFragment.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/source/data/fragments.mdx` at line 54, Update the fragment naming
examples in the documentation to use unambiguously component-scoped names,
replacing ItemFragment and UserProfileFragment with examples such as
CartItemFragment and UserProfileCardFragment while preserving the guidance about
avoiding name collisions.

@jerelmiller jerelmiller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the MDX parser had trouble parsing the custom ID and using an <h2 /> tag broke deep links on the rest of the page. I went ahead and moved this to a troubleshooting section at the bottom so that its not so in-your-face. Thanks for putting this together!

@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/@apollo/client@13365

commit: 100510c

@jerelmiller
jerelmiller merged commit 359f3e6 into apollographql:main Jul 30, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs should cover links for unique-names anchor

2 participants